package com.jsrj.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jsrj.common.annotation.Log;
import com.jsrj.common.core.controller.BaseController;
import com.jsrj.common.core.domain.AjaxResult;
import com.jsrj.common.enums.BusinessType;
import com.jsrj.domain.BackAlipayMiniDetails;
import com.jsrj.service.IBackAlipayMiniDetailsService;
import com.jsrj.common.utils.poi.ExcelUtil;
import com.jsrj.common.core.page.TableDataInfo;

/**
 * 支付宝小程序审核信息Controller
 * 
 * @author 崔宏江
 * @date 2024-07-02
 */
@RestController
@RequestMapping("/alipay/alipay-detail")
public class BackAlipayMiniDetailsController extends BaseController
{
    @Autowired
    private IBackAlipayMiniDetailsService backAlipayMiniDetailsService;

    /**
     * 查询支付宝小程序审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('alipay:alipay-detail:list')")
    @GetMapping("/list")
    public TableDataInfo list(BackAlipayMiniDetails backAlipayMiniDetails)
    {
        startPage();
        List<BackAlipayMiniDetails> list = backAlipayMiniDetailsService.selectBackAlipayMiniDetailsList(backAlipayMiniDetails);
        return getDataTable(list);
    }

    /**
     * 导出支付宝小程序审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('alipay:alipay-detail:export')")
    @Log(title = "支付宝小程序审核信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BackAlipayMiniDetails backAlipayMiniDetails)
    {
        List<BackAlipayMiniDetails> list = backAlipayMiniDetailsService.selectBackAlipayMiniDetailsList(backAlipayMiniDetails);
        ExcelUtil<BackAlipayMiniDetails> util = new ExcelUtil<BackAlipayMiniDetails>(BackAlipayMiniDetails.class);
        util.exportExcel(response, list, "支付宝小程序审核信息数据");
    }

    /**
     * 获取支付宝小程序审核信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('alipay:alipay-detail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(backAlipayMiniDetailsService.selectBackAlipayMiniDetailsById(id));
    }

    /**
     * 新增支付宝小程序审核信息
     */
    @PreAuthorize("@ss.hasPermi('alipay:alipay-detail:add')")
    @Log(title = "支付宝小程序审核信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BackAlipayMiniDetails backAlipayMiniDetails)
    {
        return toAjax(backAlipayMiniDetailsService.insertBackAlipayMiniDetails(backAlipayMiniDetails));
    }

    /**
     * 修改支付宝小程序审核信息
     */
    @PreAuthorize("@ss.hasPermi('alipay:alipay-detail:edit')")
    @Log(title = "支付宝小程序审核信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BackAlipayMiniDetails backAlipayMiniDetails)
    {
        return toAjax(backAlipayMiniDetailsService.updateBackAlipayMiniDetails(backAlipayMiniDetails));
    }

    /**
     * 删除支付宝小程序审核信息
     */
    @PreAuthorize("@ss.hasPermi('alipay:alipay-detail:remove')")
    @Log(title = "支付宝小程序审核信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(backAlipayMiniDetailsService.deleteBackAlipayMiniDetailsByIds(ids));
    }
}
